"""Interfaceautomationplatform URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""

from django.urls import path, re_path
from django.views.static import serve
from django.conf import settings
from apps.app01.views import project
from apps.app01.views import case
from apps.app01.views import wiki
from apps.app01.views import file
from apps.app01.views import domain

urlpatterns = [
    # 项目表相关
    path("", project.default_page, name="defaultPage"),
    re_path(r'^item/$', project.Index.as_view(), name="index"),
    re_path(r'^delete_it/$', project.delete_it, name='delete_it'),
    re_path(r'^search/$', project.search, name="search"),
    # 接口用例相关
    re_path(r'^item/upload/(?P<pk>\d+)', case.upload, name="upload"),  # 批量导入用例
    re_path(r'^item/list_api/(?P<pk>\d+)/$', case.list_api, name='list_api'),
    re_path(r'^item/edit_api/(?P<pk>\d+)/$', case.edit_api, name='edit_api'),
    re_path(r'^delete_api/$', case.delete_api, name="delete_api"),
    re_path(r'^order_by/$', case.order_by, name="order_by"),
    # 执行用例
    re_path(r'^run_case/(?P<pk>\d+)/$', case.run_case, name="run_case"),
    # 下载用例执行报告download_case_report
    re_path(r'^download_case_report/(?P<pk>\d+)/$', case.download_case_report, name="download_case_report"),
    # log日志
    re_path(r'^logs_list/$', case.logs_list, name="logs_list"),
    # 预览
    re_path(r'^preview/(?P<pk>\d+)/$', case.preview, name="preview"),
    # 可视化
    re_path(r'^show_tab/$', case.show_tab, name="show_tab"),
    # 发邮件
    re_path(r'^show_email/$', case.send_email, name="send_email"),
    # wiki模块
    re_path(r'^wiki/$', wiki.wiki, name="wiki"),
    # 添加
    re_path(r'^wiki/add/$', wiki.wiki_add, name="wiki_add"),
    re_path(r'^wiki/catalog/$', wiki.wiki_catalog, name="wiki_catalog"),
    # wiki上传图片
    re_path(r'^wiki_upload/$', wiki.wiki_upload, name="wiki_upload"),
    # 编辑
    re_path(r'^wiki/edit/(?P<wiki_id>\d+)/$', wiki.wiki_edit, name='wiki_edit'),
    # 删除 delete_api
    re_path(r'^delete_wiki/(?P<wiki_id>\d+)/$', wiki.delete_wiki, name='delete_wiki'),
    # 预览图片
    re_path(r'media/(?P<path>.*)$', serve, {"document_root": settings.MEDIA_ROOT}),
    # 文件页面
    re_path(r'^file/$', file.file, name="file"),
    # 域名管理
    re_path(r'^domain/$',domain.domain_list,name="domain"),
    # 删除域名
    re_path(r'^domain_delete/$', domain.domain_delete, name="domain_delete"),
    # 删除
    re_path(r'^file_delete/$', file.file_delete, name="file_delete"),
    # 上传文件大小验证
    re_path(r'^file_size/$', file.file_size, name="file_size"),
    # 下载文件
    re_path(r'^file_download/(.+)/$', file.file_download, name="file_download"),
    # apk上传
    re_path(r'^apk_home/$', file.apk_home, name="apk_home"),
    # apk删除
    re_path(r'^apk_delete/$', file.apk_delete, name="apk_delete"),
    # apk下载
    re_path(r'^apk_download/$', file.apk_download, name="apk_download"),

]
